package ioc05;

/**
 * Author：汤小洋
 * Date：2022-11-22 15:59
 * Description：<描述>
 */
public class MyUtil {

    public static void showName(){
        /**
         *  这里不运用再重新创建IoC容器，否则会有多个容器
         */
        // ApplicationContext ac = new ClassPathXmlApplicationContext("ioc05/spring.xml");
        // System.out.println(ac);
        // SpringBean springBean = (SpringBean) ac.getBean("springBean");
        // System.out.println(springBean.getName());

        SpringBean springBean = (SpringBean) ApplicationContextHolder.getBean("springBean");
        System.out.println(springBean.getName());


    }
}
